<template>
  <div class="app-container" v-if="loading">
    <p>页面跳转中......</p>
  </div>
</template>

<script>
export default {
  name: "external",
  data() {
    return {
      phonenumber: '',
      authToken: '',
      loading: true
    }
  },
  created() {
    const phonenumber = this.$route.query.phonenumber || ''
    const authToken = this.$route.query.authToken || ''
    this.noPasswordLogin(phonenumber,authToken)
  },
  methods: {
    noPasswordLogin(phonenumber,authToken) {
      console.log('phonenumber',phonenumber)
      console.log('authToken',authToken)
      const loginForm = {
        phonenumber: phonenumber,
        authToken: authToken
      }
      this.$store.dispatch("noPasswordLogin", loginForm).then(() => {
        this.loading = false;
        this.$router.push({ path: "/index" }).catch(()=>{});
      }).catch(() => {
        this.loading = false;
        this.$router.push({ path: "/login" }).catch(()=>{});
      });
    }
  }
}
</script>

<style scoped>

</style>
